package com.qf.blog.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PageController {

    @RequestMapping ("/")
    public String index() {
        return "forward:/post/action/query?current=1";
    }

    @RequestMapping ("/{page}.html")
    // @PathVariable:获取的就是{page}内容
    public String toPage(@PathVariable String page) { // 这样写拿的是?page=123
        return page;
    }

    // 两层路径跳转
    @RequestMapping ("/{path}/{page}.html")
    public String toPage2(@PathVariable String path, @PathVariable String page) {
        return path + "/" + page;
    }
}
